package com.sc.nft.admin.controller;

import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.AdminPropEquityVistInSaveDTO;
import com.sc.nft.entity.dto.PageAdminEquityPropsVistInDTO;
import com.sc.nft.entity.vo.PageAdminEquityPropsVistInVO;
import com.sc.nft.service.PropEquityVestInService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/equityVistIn")
@Api(tags = "后台权益道具绑定")
public class AdminEquityPropsVistInController {

    private final PropEquityVestInService propEquityVestInService;


    @PostMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "获取权益道具列表", notes = "获取权益道具列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<PageAdminEquityPropsVistInVO> page(@Valid @RequestBody PageAdminEquityPropsVistInDTO request) {
        return PageResult.success(propEquityVestInService.getPageAdminEquityPropsVistIn(request));
    }


    @PostMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value ="新增", notes = "新增", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result save(@RequestBody AdminPropEquityVistInSaveDTO adminPropEquityVistInSaveDTO){
        propEquityVestInService.save(adminPropEquityVistInSaveDTO);
        return Result.success();
    }

}
